<?php
namespace  app\utils;
use Predis\Client;
use think\facade\Config;
use think\facade\Log;

class RedisUtils{
static $client = null;

    public function boot()
    {
        static::createInstance();
    }

    static function createInstance(){
        if(self::$client  instanceof Client){
            return self::$client;
        }
        self::$client=  new Client([
            'scheme' => 'tcp',
            'host'   => Config::get('redis.host'),
            'port'   => Config::get('redis.port'),
            'password'=>Config::get('redis.password')
        ]);

    }

    static function setStr($key,$value){
        self::$client->set($key, $value);
    }
    static function getStr($key){
       return  self::$client->get($key);
    }
    static function del($key){
        return  self::$client->del($key);
    }


}